﻿using ExampleGame.Components.Score;
using ExampleGame.GameSystems;
using IcicleFramework.Actions;
using IcicleFramework.GameServices;
using Microsoft.Xna.Framework;

namespace ExampleGame.Actions
{
    public class GivePointsAction : GameAction 
    {
        public float Points { get; set; }

        public GivePointsAction() { }

        protected GivePointsAction(GivePointsAction old) 
            : base(old)
        {
            Points = old.Points;
        }

        public override void Update(GameTime gameTime)
        {
            var scoreManager = GameServiceManager.GetService<IScoreManager>();

            scoreManager.AddPoints(Target, Points);

            Finished = true;
        }

        public override IGameAction DeepClone()
        {
            return new GivePointsAction(this);
        }
    }
}
